package com.sxhuayuan.parking.plugin.parking.result;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sxhuayuan.parking.utils.DateUtils;

/**
 * 查询一辆车的月卡信息
 */
public class McardQueryResultWrap extends BaseResultWrap {

	private static final long serialVersionUID = 2938510737375026854L;

	public static final String CACHE_NAME = "monthCardQueryResultCache";

	/** 用户编号 */
	private String userNo;
	/** 用户姓名 */
	@JsonIgnore
	private String name;
	/** 月租 全部用String表示 */
	private String monthlyRent;
	/** 缴费类型id */
	private String tariffId;
	/** 车牌号 */
	private String carPlate;
	/** 返回车牌id */
	private Long carPlateId;
	/** 当前过期时间 */
	private String currExpiryDate;
	/** 延期后的过期时间 */
	private String preExpiryDate;
	/** 车位数量 */
	private String berth;
	/** 缴费依据 */
	private String chargeBy;

	public McardQueryResultWrap() {
		super(true, null);
	}

	public McardQueryResultWrap(Boolean isSuccess, String msg) {
		super(isSuccess, msg);
	}

	public String getUserNo() {
		return userNo;
	}

	public void setUserNo(String userNo) {
		this.userNo = userNo;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMonthlyRent() {
		return monthlyRent;
	}

	public void setMonthlyRent(String monthlyRent) {
		this.monthlyRent = monthlyRent;
	}

	public String getCurrExpiryDate() {
		return currExpiryDate;
	}

	public void setCurrExpiryDate(String currExpiryDate) {
		this.currExpiryDate = currExpiryDate;
	}

	public String getPreExpiryDate() {
		return preExpiryDate;
	}

	public void setPreExpiryDate(String preExpiryDate) {
		this.preExpiryDate = preExpiryDate;
	}

	public String getBerth() {
		return berth;
	}

	public void setBerth(String berth) {
		this.berth = berth;
	}

	public String getChargeBy() {
		return chargeBy;
	}

	public void setChargeBy(String chargeBy) {
		this.chargeBy = chargeBy;
	}

	/**
	 * 月卡是否已过期 传入当前时间，由于车场服务器时间和本系统时间可能不一致，所以如果可以拿到车场时间则使用车场的时间
	 * 
	 * @return
	 */
	public boolean isMonthCardExpired() {
		Date now = getTime() == null ? new Date() : getTime();
		if (currExpiryDate != null) {
			return now.after(DateUtils.parse(currExpiryDate));
		}
		return false;
	}

	public String getCarPlate() {
		return carPlate;
	}

	public void setCarPlate(String carPlate) {
		this.carPlate = carPlate;
	}

	public String getTariffId() {
		return tariffId;
	}

	public void setTariffId(String tariffId) {
		this.tariffId = tariffId;
	}

	public Long getCarPlateId() {
		return carPlateId;
	}

	public void setCarPlateId(Long carPlateId) {
		this.carPlateId = carPlateId;
	}
}